package com.settings.service.entitlementService.att;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.settings.service.entitlementService.MhsConstants;

/**
 * @Descpition:
 * @Author wpc
 * @Date 2023/7/20 23:32
 **/
public class AttMhsService extends Service {

    private Messenger mhsClientMessenger;
    private Messenger messenger = new Messenger(new MessengerHandler());
    private int responseCode;
    private boolean authentication;

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return messenger.getBinder();
    }


    private class MessengerHandler extends Handler{
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            mhsClientMessenger = msg.replyTo;
            int authenticationType = msg.what;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (authenticationType == MhsConstants.START_HOTSPOT_TETHER) {
                           startAuthentication(authentication,responseCode);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }
    }

    public void startAuthentication(boolean authentication,Integer responseCode){

    }
    public void slog(String log){
        Log.d("entitlement",log);
    }
}
